package generated.com.euncet.example.dictionaries;

public class CategoryDictionary {
	
	@SuppressWarnings("unchecked")
	public static java.util.List<com.euncet.example.Category> getCategories()
	{
		javax.persistence.EntityManager em = generated.rmo.utils.EntityManagerFactorySingleton.getEntityManager();
		
		String q = "SELECT c FROM Category c";
		
		javax.persistence.Query query = em.createQuery(q);
		
		java.util.List<com.euncet.example.Category> results = query.getResultList();
		
		return results;
	}
	
	public static com.euncet.example.Category getCategoryById(long id)
	{
		javax.persistence.EntityManager em = generated.rmo.utils.EntityManagerFactorySingleton.getEntityManager();
		
		com.euncet.example.Category result = em.find(com.euncet.example.Category.class, id);
		
		return result;
	}
	
	public static void addCategory(com.euncet.example.Category category)
	{
		javax.persistence.EntityManager em = generated.rmo.utils.EntityManagerFactorySingleton.getEntityManager();
		
	    em.persist(category);
	}
	
	public static void removeCategory(long id)
	{
		removeCategory(getCategoryById(id));
	}
	
	public static void removeCategory(com.euncet.example.Category category)
	{
		javax.persistence.EntityManager em = generated.rmo.utils.EntityManagerFactorySingleton.getEntityManager();
		
	    em.remove(category);
	}
}
